From: Florian Müllner Date: Wed, 19 Feb 2020 00:52:59 +0000 (+0100) Subject: dateMenu: Use BindConstraint for indicator pad X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~772^2^2~99 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=6e7344b837e8d90593104418d47544687597ddc6;p=gnome-shell.git dateMenu: Use BindConstraint for indicator pad Now that Clutter.BindConstraint modifies the size request in addition to the allocation, we can use it instead of the custom IndicatorPad widget. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/1026 --- diff --git a/js/ui/dateMenu.js b/js/ui/dateMenu.js index 8fb56b192..fbfccfc1b 100644 --- a/js/ui/dateMenu.js +++ b/js/ui/dateMenu.js @@ -488,26 +488,6 @@ class MessagesIndicator extends St.Icon { } }); -var IndicatorPad = GObject.registerClass( -class IndicatorPad extends St.Widget { - _init(actor) { - this._source = actor; - this._source.connect('notify::size', () => this.queue_relayout()); - super._init(); - this._source.bind_property('visible', - this, 'visible', - GObject.BindingFlags.SYNC_CREATE); - } - - vfunc_get_preferred_width(forHeight) { - return this._source.get_preferred_width(forHeight); - } - - vfunc_get_preferred_height(forWidth) { - return this._source.get_preferred_height(forWidth); - } -}); - var FreezableBinLayout = GObject.registerClass( class FreezableBinLayout extends Clutter.BinLayout { _init() { @@ -576,8 +556,17 @@ class DateMenuButton extends PanelMenu.Button { this._clockDisplay = new St.Label({ y_align: Clutter.ActorAlign.CENTER }); this._indicator = new MessagesIndicator(); + const indicatorPad = new St.Widget(); + this._indicator.bind_property('visible', + indicatorPad, 'visible', + GObject.BindingFlags.SYNC_CREATE); + indicatorPad.add_constraint(new Clutter.BindConstraint({ + source: this._indicator, + coordinate: Clutter.BindCoordinate.SIZE, + })); + let box = new St.BoxLayout({ style_class: 'clock-display-box' }); - box.add_actor(new IndicatorPad(this._indicator)); + box.add_actor(indicatorPad); box.add_actor(this._clockDisplay); box.add_actor(this._indicator);